import { setToken } from '@/utils/auth'
import request from '@/utils/request'
import { changeToken } from '../modules/login'

// 3. 异步action
export const loginAction = (formData) => {
  return async (dispatch, getState) => {
    const { data } = await request.post('/authorizations', formData)
    console.log('data数据：', data.data.token)
    dispatch(changeToken(data.data.token))
    setToken(data.data.token)
  }
}